package com.sky.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.sky.bean.User;
import com.sky.dao.ActorMapper;
import com.sky.service.PageHelpService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@Slf4j
public class PageHelpServiceImpl implements PageHelpService<User>{

    @Autowired
    private ActorMapper actorMapper;

    @Override
    public PageInfo users() {
        PageHelper.startPage(3, 1);
        List<User> users = actorMapper.users();
        final PageInfo<User> pageInfo=new PageInfo<>(users);
        log.info("actually total size = {}",pageInfo.getTotal());
        log.info("actually total size = {}",users);
        return pageInfo;
    }
}
